package edu.wpi.cs509.clientlogic;

import edu.wpi.cs509.ui.intfc.PlayerStatsInterface;
import edu.wpi.cs509.representation.UserStatistics;

/**
 * This class is the realization of the PlayerStatsInterface for the UI
 * It is essentially a container for a UserStatistics object returned
 * by the server and allows the required UI functionality
 * 
 * @author mjsanchez
 */
public class PlayerStatsInterfaceObject implements PlayerStatsInterface {
	/**
	 * The internal UserStatistics object
	 */
	private UserStatistics userStats;
	
	/**
	 * Users rank
	 */
	private int rank;
	
	/**
	 * @param stats - the interanal UserStatistics object contained in the interface
	 */
	public PlayerStatsInterfaceObject(UserStatistics stats) {
		this.userStats = stats;
	}
	
	/**
	 * @param stats - the interanal UserStatistics object contained in the interface
	 */
	public PlayerStatsInterfaceObject(UserStatistics stats, int rank) {
		this.userStats = stats;
		this.rank = rank;
	}
	
	/**
	 * @return the username of the contained internal UserStatistics object
	 */
	public String getUsername() {
		return userStats.getUsername();
	}

	@Override
	public int getRank() {
		// TODO Auto-generated method stub
		return this.rank;
	}

	/**
	 * @return the number of games won contained in the internal UserStatistics object
	 */
	public int getGamesWon() {
		return userStats.getGamesWon();
	}

	/**
	 * @return the number of games lost contained in the internal UserStatistics object
	 */
	public int getGamesLost() {
		return userStats.getGamesLost();
	}

}
